#define NEAR 25 //cm
#define quart_droite RotateMotorEx(OUT_BC, 50, 550, -100, true, true);
#define quart_gauche RotateMotorEx(OUT_BC, 50, -550, 100, true, true);
#define demi_tour_gauche RotateMotorEx(OUT_BC, 50, -1100, 100, true, true);
#define demi_tour_droite RotateMotorEx(OUT_BC, 50, 1100, -100, true, true);
task main()
{
SetSensorLowspeed(S4);
while(true)
{
OnFwd(OUT_BC,50);
if (SensorUS(S4) < NEAR)
{
int x = Random(2) + 1;
if (x == 1)
{quart_gauche}
else
{quart_droite}
}
}
}